perm filename TEST[F84,JMC] blob
sn#780106 filedate 1984-12-13 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 (defun shapes (n)
C00003 ENDMK
Cā;
(defun shapes (n)
(if (= n 1)
'(a)
(do ((i 1 (1+ i))
(u nil (append (cartesian (shapes i) (shapes (- n i))) u)))
((= i n) u))))
(defun cartesian (u v)
(do ((u1 u (cdr u1))
(w nil (append (mapcar #'(lambda (x) (cons (car u1) x)) v) w)))
((null u1) w)))
(cartesian '(a b) '(c d))
(shapes 1)
(shapes 2)
(shapes 3)
(length (shapes 4))
(length (shapes 5))